package fr.jhaccoun.demenager_eco.produit;

import java.util.List;

import org.apache.commons.lang.Validate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
@Service
@Transactional(readOnly = true)
public class CategorieServiceImpl implements CategorieService {

 
	@Autowired
	private CategorieDao categorieDao;
	
	@Override
	@Transactional
	public List<Categorie> getAllCategories() {
		return categorieDao.findAll(); 
	}
	
	@Override
	@Transactional(readOnly = true)
	public Categorie findByCode(String code) {
		Validate.notNull(code);
		return categorieDao.findByCode(code);
	}
}
